import store from "../../store"
import creator from "../../store/actions/asyncActionCreator"
const Product = () => {
    let handleSend = () => {
        store.dispatch(creator('GET_PRODUCT', 'getProduct'))
    }
    let { product } = store.getState();
    //创建列表
    let lis = product.map((item) => {
        return (
            <li key={item.id}>{item.title}</li>
        )
    })
    return (
        <fieldset>
            <legend>产品</legend>
            <button onClick={handleSend}>点击发送请求</button>
            <ul>
                {lis}
            </ul>
        </fieldset>
    )
}

export default Product